add devcontainer and modify interactive install scripts#1
add devcontainer and modify interactive install scripts#1
Conversation
add non interactive installation
|
@chheis would you mind rebasing your PR so that I can approve it? What are the errors you're having with interactive mode? I can help to fix it. |
@vtz Merged the newest changes from your main branch. The issue with the interactive mode is that I wanted to use your dev tools installation script, instead of putting them all in the dev container script. (Avoid double work) So I think it would be up to you, to decide which way you like to go:
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.devcontainer/devcontainer.json:
- Line 16: The postCreateCommand currently clones opensomeip which will build a
fresh copy instead of the mounted workspace; update the postCreateCommand to
stop cloning and instead operate on the mounted workspace (e.g., remove the git
clone and the conditional if [ ! -d opensomeip ]; then ... fi, and ensure the
commands run from the workspace folder), then run chmod +x
./scripts/setup_deps.sh ./scripts/install_dev_tools.sh and invoke sudo
./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer &&
the existing mkdir build && cmake ... && cmake --build . -j so the container
builds the checked-out branch and local changes rather than a newly cloned repo.
- Around line 1-4: Update the devcontainer image to a fixed release tag instead
of :latest by replacing the "image" value
"ghcr.io/eclipse-score/devcontainer:latest" with a specific release (e.g.,
"ghcr.io/eclipse-score/devcontainer:v1.1.0" or another pinned tag like
1.0.0/0.1.0) in .devcontainer/devcontainer.json so the devcontainer uses a
reproducible version; ensure the "image" property string is updated accordingly.
In `@scripts/install_dev_tools.sh`:
- Around line 165-183: The PIP_CMD variable is currently a plain string and is
expanded unquoted (risking word-splitting); change PIP_CMD to a bash array
(e.g., PIP_CMD=(python3 -m pip)) and update all invocations to use the array
expansion form ("${PIP_CMD[@]}") including the echo/prints and both sudo and
non-sudo calls inside the DEVCONTAINER_MODE branch and the else branch so
commands like sudo $PIP_CMD install ... become sudo "${PIP_CMD[@]}" install ...
and $PIP_CMD install ... become "${PIP_CMD[@]}" install ... to safely handle
spaces and avoid SC2086.
| { | ||
| "name": "opensomeip on S-CORE devcontainer", | ||
| "image": "ghcr.io/eclipse-score/devcontainer:latest", | ||
| "remoteUser": "vscode", |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🌐 Web query:
ghcr.io/eclipse-score/devcontainer image tags releases
💡 Result:
For ghcr.io/eclipse-score/devcontainer, the “release” versions correspond to Git tags in eclipse-score/devcontainer:
0.1.0(Nov 10, 2025) [1]1.0.0(Nov 26, 2025) [1]v1.1.0(Nov 28, 2025) [1]
The repo README says you should use ghcr.io/eclipse-score/devcontainer:<version> where <version> is a “valid, published release”, and it also mentions floating tags main (tracks the main branch) and latest (tracks release tags). [2]
To list the actual tags available in GHCR, query the registry tags endpoint (may require auth depending on package visibility):
curl https://ghcr.io/v2/eclipse-score/devcontainer/tags/list [3]
Sources: [1] Git tags page, [2] repo README, [3] GHCR tag listing approach via GHCR v2 API.
🌐 Web query:
eclipse-score devcontainer GitHub repository
💡 Result:
The Eclipse S-CORE DevContainer is maintained in the GitHub repo:
eclipse-score/devcontainer(Common Devcontainer for Eclipse S-CORE) (github.com)
Citations:
Pin the devcontainer image to a specific release tag.
The eclipse-score/devcontainer repository recommends using specific versions instead of :latest. Available releases include 0.1.0, 1.0.0, and v1.1.0. Pinning improves reproducibility and supply-chain stability.
Proposed change
- "image": "ghcr.io/eclipse-score/devcontainer:latest",
+ "image": "ghcr.io/eclipse-score/devcontainer:1.0.0",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "name": "opensomeip on S-CORE devcontainer", | |
| "image": "ghcr.io/eclipse-score/devcontainer:latest", | |
| "remoteUser": "vscode", | |
| { | |
| "name": "opensomeip on S-CORE devcontainer", | |
| "image": "ghcr.io/eclipse-score/devcontainer:1.0.0", | |
| "remoteUser": "vscode", |
🤖 Prompt for AI Agents
In @.devcontainer/devcontainer.json around lines 1 - 4, Update the devcontainer
image to a fixed release tag instead of :latest by replacing the "image" value
"ghcr.io/eclipse-score/devcontainer:latest" with a specific release (e.g.,
"ghcr.io/eclipse-score/devcontainer:v1.1.0" or another pinned tag like
1.0.0/0.1.0) in .devcontainer/devcontainer.json so the devcontainer uses a
reproducible version; ensure the "image" property string is updated accordingly.
| } | ||
| }, | ||
|
|
||
| "postCreateCommand": "set -e && sudo apt-get update && if [ ! -d opensomeip ]; then git clone https://github.com/vtz/opensomeip.git; fi && cd opensomeip && chmod +x ./scripts/setup_deps.sh ./scripts/install_dev_tools.sh && sudo ./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build . -j" |
There was a problem hiding this comment.
Avoid cloning the repo inside postCreateCommand.
The devcontainer already mounts the workspace; cloning a fresh copy will build the wrong code (e.g., main instead of the checked-out branch) and ignores local changes.
Proposed fix
- "postCreateCommand": "set -e && sudo apt-get update && if [ ! -d opensomeip ]; then git clone https://github.com/vtz/opensomeip.git; fi && cd opensomeip && chmod +x ./scripts/setup_deps.sh ./scripts/install_dev_tools.sh && sudo ./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build . -j"
+ "postCreateCommand": "set -e && sudo apt-get update && cd ${containerWorkspaceFolder} && chmod +x ./scripts/setup_deps.sh ./scripts/install_dev_tools.sh && sudo ./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build . -j"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "postCreateCommand": "set -e && sudo apt-get update && if [ ! -d opensomeip ]; then git clone https://github.com/vtz/opensomeip.git; fi && cd opensomeip && chmod +x ./scripts/setup_deps.sh ./scripts/install_dev_tools.sh && sudo ./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build . -j" | |
| "postCreateCommand": "set -e && sudo apt-get update && cd ${containerWorkspaceFolder} && chmod +x ./scripts/setup_deps.sh ./scripts/install_dev_tools.sh && sudo ./scripts/setup_deps.sh && sudo ./scripts/install_dev_tools.sh --devcontainer && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build . -j" |
🤖 Prompt for AI Agents
In @.devcontainer/devcontainer.json at line 16, The postCreateCommand currently
clones opensomeip which will build a fresh copy instead of the mounted
workspace; update the postCreateCommand to stop cloning and instead operate on
the mounted workspace (e.g., remove the git clone and the conditional if [ ! -d
opensomeip ]; then ... fi, and ensure the commands run from the workspace
folder), then run chmod +x ./scripts/setup_deps.sh
./scripts/install_dev_tools.sh and invoke sudo ./scripts/setup_deps.sh && sudo
./scripts/install_dev_tools.sh --devcontainer && the existing mkdir build &&
cmake ... && cmake --build . -j so the container builds the checked-out branch
and local changes rather than a newly cloned repo.
| # Prefer python -m pip to avoid pip/pip3 ambiguity | ||
| if python3 -m pip --version &> /dev/null; then | ||
| PIP_CMD="python3 -m pip" | ||
| else | ||
| echo "❌ pip not found. Install pip first." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "📦 Installing Python packages with $PIP_CMD..." | ||
| $PIP_CMD install --user gcovr pytest pytest-cov | ||
| echo "📦 Installing Python packages with: $PIP_CMD" | ||
|
|
||
| if [[ "$DEVCONTAINER_MODE" -eq 1 ]]; then | ||
| # Devcontainer: system-wide install requested | ||
| sudo $PIP_CMD install --upgrade pip | ||
| sudo $PIP_CMD install gcovr pytest pytest-cov | ||
| else | ||
| # Local developer default: user install (no sudo/pollution) | ||
| $PIP_CMD install --user --upgrade pip | ||
| $PIP_CMD install --user gcovr pytest pytest-cov | ||
| fi |
There was a problem hiding this comment.
Quote/array-wrap PIP_CMD to avoid word-splitting.
PIP_CMD="python3 -m pip" is expanded unquoted, which triggers SC2086 and can break if any path contains spaces. Use a bash array for safe invocation.
Proposed fix
- if python3 -m pip --version &> /dev/null; then
- PIP_CMD="python3 -m pip"
+ if python3 -m pip --version &> /dev/null; then
+ PIP_CMD=(python3 -m pip)
else
echo "❌ pip not found. Install pip first."
exit 1
fi
- echo "📦 Installing Python packages with: $PIP_CMD"
+ echo "📦 Installing Python packages with: ${PIP_CMD[*]}"
if [[ "$DEVCONTAINER_MODE" -eq 1 ]]; then
# Devcontainer: system-wide install requested
- sudo $PIP_CMD install --upgrade pip
- sudo $PIP_CMD install gcovr pytest pytest-cov
+ sudo "${PIP_CMD[@]}" install --upgrade pip
+ sudo "${PIP_CMD[@]}" install gcovr pytest pytest-cov
else
# Local developer default: user install (no sudo/pollution)
- $PIP_CMD install --user --upgrade pip
- $PIP_CMD install --user gcovr pytest pytest-cov
+ "${PIP_CMD[@]}" install --user --upgrade pip
+ "${PIP_CMD[@]}" install --user gcovr pytest pytest-cov
fi📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Prefer python -m pip to avoid pip/pip3 ambiguity | |
| if python3 -m pip --version &> /dev/null; then | |
| PIP_CMD="python3 -m pip" | |
| else | |
| echo "❌ pip not found. Install pip first." | |
| exit 1 | |
| fi | |
| echo "📦 Installing Python packages with $PIP_CMD..." | |
| $PIP_CMD install --user gcovr pytest pytest-cov | |
| echo "📦 Installing Python packages with: $PIP_CMD" | |
| if [[ "$DEVCONTAINER_MODE" -eq 1 ]]; then | |
| # Devcontainer: system-wide install requested | |
| sudo $PIP_CMD install --upgrade pip | |
| sudo $PIP_CMD install gcovr pytest pytest-cov | |
| else | |
| # Local developer default: user install (no sudo/pollution) | |
| $PIP_CMD install --user --upgrade pip | |
| $PIP_CMD install --user gcovr pytest pytest-cov | |
| fi | |
| # Prefer python -m pip to avoid pip/pip3 ambiguity | |
| if python3 -m pip --version &> /dev/null; then | |
| PIP_CMD=(python3 -m pip) | |
| else | |
| echo "❌ pip not found. Install pip first." | |
| exit 1 | |
| fi | |
| echo "📦 Installing Python packages with: ${PIP_CMD[*]}" | |
| if [[ "$DEVCONTAINER_MODE" -eq 1 ]]; then | |
| # Devcontainer: system-wide install requested | |
| sudo "${PIP_CMD[@]}" install --upgrade pip | |
| sudo "${PIP_CMD[@]}" install gcovr pytest pytest-cov | |
| else | |
| # Local developer default: user install (no sudo/pollution) | |
| "${PIP_CMD[@]}" install --user --upgrade pip | |
| "${PIP_CMD[@]}" install --user gcovr pytest pytest-cov | |
| fi |
🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 177-177: Double quote to prevent globbing and word splitting.
(SC2086)
[info] 178-178: Double quote to prevent globbing and word splitting.
(SC2086)
🤖 Prompt for AI Agents
In `@scripts/install_dev_tools.sh` around lines 165 - 183, The PIP_CMD variable is
currently a plain string and is expanded unquoted (risking word-splitting);
change PIP_CMD to a bash array (e.g., PIP_CMD=(python3 -m pip)) and update all
invocations to use the array expansion form ("${PIP_CMD[@]}") including the
echo/prints and both sudo and non-sudo calls inside the DEVCONTAINER_MODE branch
and the else branch so commands like sudo $PIP_CMD install ... become sudo
"${PIP_CMD[@]}" install ... and $PIP_CMD install ... become "${PIP_CMD[@]}"
install ... to safely handle spaces and avoid SC2086.
I added a devcontainer configuration to setup a fast and easy environment.
But, with reusing the setup scripts the interactive input is still mandatory.
So did not work out yet.
Maybe in a collaborative cooperation we can fix it. Or use only the devcontainer setup?
Summary by CodeRabbit